home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Multimedia Madness 2 #12
/
Multimedia Madness - Volume 2 - Issue 12 (SAMS Publishing) (November 25, 1992).iso
/
nemo
/
stringpp
/
str.his
< prev
next >
Wrap
Text File
|
1992-10-08
|
3KB
|
104 lines
String++ Revision History
Copyright (c)1992 by Carl Moreland
10/08/92
-----------------------------------------------------------------------
Version 2.10
- Derived class String from class string for those who prefer the capi-
talized spelling.
- Minor documentation changes
-----------------------------------------------------------------------
Version 2.01
- Minor bug fixes
-----------------------------------------------------------------------
Version 2.0
- Added iostream support.
- Enhanced [] operator can now assign individual characters.
- Comparison functions are now implemented as inline.
- New general functions:
Insert() inserts text in str
Delete() deletes a substring of str
Copy() copies str to a non-const char*
Trim() trims leading or trailing multiple chars from str.
Value() returns the numeric value (int or long) of str.
- Existing methods have been renamed to begin with an uppercase letter,
such as string::justify() -> string::Justify(). The older naming con-
ventions are still supported for backwards compatibility. Most member
methods now operate directly on the string itself instead of returning
a new string. For example, str1.Justify() will modify str1 instead of
creating a new string. C-style function names remain all lower-case
and return newly created strings, so str2 = justify(str1, LEFT, 80)
will not modify str1.
- AWK functions are also implemented as member methods that directly
modify the string object. These versions begin with an uppercase.
- Constructors and = operators added for int & long data types. New
function Value() returns the numeric value of a string.
- The () operator continues to return a const char* to the string
object's data, but the ptr() method now returns a non-const char*.
Therefore, if you need to pass a string's contents to a C-style func-
tion that wants a non-const char*, use ptr():
Old way:
strupr((char *)s1()); // strupr() wants to modify s1 directly
// so s1 must be cast as non-const
New way:
strupr(s1.ptr()); // s1.ptr() is now non-const
Returning a non-const char* completely strips the inherent protection
that the string class offers and can be very dangerous. Use this with
caution.
-----------------------------------------------------------------------
Version 1.1
- Bug fixes, mostly memory leaks.
- Rewrote several functions for improved efficiency.
- Improved demo program.
- gsub() is generalized with the inclusion of a num parameter.
- New justify() function.
- New operators * and *=.
-----------------------------------------------------------------------
Version 1.0
- Initial release.
-----------------------------------------------------------------------
Comments, suggestions, and bug reports are welcomed. Send them to me
via Internet (carl.moreland@analog.com), CompuServe (72137,2657), or
mail them to:
Carl Moreland
4314 Filmore Rd
Greensboro, NC 27409